package alo;

/**
 * @ClassName t9
 * @Description TODO
 * @Author Fanxc
 * @DATE 2021/4/20 17:30
 * @Version 1.0
 */
public class t9 {
    public String solve (String s, String t) {
        char[] chars1 = s.toCharArray();
        char[] chars2 = t.toCharArray();
        char[] result=new char[Math.max(chars1.length,chars2.length)+1];
        int l1= chars1.length-1;
        int l2=chars2.length-1;
        int l3= result.length-1;
        int c=0;
        while (l1>=0&&l2>=0){
            int a=chars1[l1]-'0';
            int b=chars2[l2]-'0';
            result[l3]=(char)((a+b+c)%10+'0');
            c=(a+b+c)/10;
        }
        while (l1>=0){
            int a=chars1[l1]-'0';
            result[l3]=(char)((a+c)%10+'0');
            c=(a+c)/10;
        }
        while (l2>=0){
            int b=chars2[l2]-'0';
            result[l3]=(char)((b+c)%10+'0');
            c=(b+c)/10;
        }
        if (c!=0){
            result[l3]=(char) (c+'0');
            return String.valueOf(result);
        }
        return String.valueOf(result).substring(1);
    }
}
